set more off
set graphics off
clear all 	
set maxvar 32000
set matsize 800

*CAUTION!!! Local paths have to be adjusted for do-file to work! 
*global root ""
*cd "$root"

*glo tables ""
*glo figures ""

ssc install outreg2 , replace 
ssc install copydesc , replace 


use "maternity_dataset" , replace

*************************************************************************************************************************************************************************************** 
************************************************************* MAIN PAPER ************************************************************* 
*************************************************************************************************************************************************************************************** 

###FIGURE 1

preserve

tab oldest_contract_table if sample_mothers==1 ,  gen(oldest_contract_table_)

collapse (mean) oldest_contract_table_* if sample_mothers==1 , by(oldest_newbirthdecade)

*set graphics on

twoway (connected oldest_contract_table_1 oldest_newbirthdecade, lc(black) lw(thick) mc(black) msize(large))  ///
(connected oldest_contract_table_2 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) ///
, ///
ylabel(0(0.2)0.7, labsize(small)) ///
subtitle("Mothers' Contract at First Chilbirth",) ///
xlabel(1980 "Before 1990" 1990 "1990-99" 2000 "2000-09" 2010 "2010-19", labsize(small)) ///
xtitle("Childbirth Decade",size(small)) ytitle("Share of Mothers", size(small)) ///
graphregion(col(white)) bgcol(white)	plotregion(lc(black)) ///
legend(order(1 "Fixed-Term/Probationary" 2 "Permanent") rows(1) size(small))


gr export "Figures/Figure_1.png", width(4000) replace

restore


###FIGURE 2

est clear
preserve

tab oldest_edupartner_table if sample_mothers==1 ,  gen(oldest_edupartner_table_)

collapse (mean) oldest_edupartner_table_* if sample_mothers==1 , by(oldest_newbirthdecade)

*set graphics on

twoway (connected oldest_edupartner_table_1 oldest_newbirthdecade, lc(black) lw(thick) mc(black) msize(large))  ///
(connected oldest_edupartner_table_2 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) ///
(connected oldest_edupartner_table_3 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) /// 
, ///
ylabel(0(0.2)0.7, labsize(small)) ///
subtitle("Partner Education at First Chilbirth",) ///
xlabel(1980 "Before 1990" 1990 "1990-99" 2000 "2000-09" 2010 "2010-19", labsize(small)) ///
xtitle("Childbirth Decade",size(small)) ytitle("Share of Mothers", size(small)) ///
graphregion(col(white)) bgcol(white)	plotregion(lc(black)) ///
legend(order(1 "Secondary or Below" 2 "College / University" 3 "Masters / PhD") rows(1) size(small))


gr export "Figures/Figure_2.png", width(4000) replace

restore


###FIGURE 3

est clear

preserve

tab oldest_partnerhelp_table if sample_mothers==1 , gen(oldest_partnerhelp_table_)

collapse (mean) oldest_partnerhelp_table_* if sample_mothers==1 , by(oldest_newbirthdecade)

*set graphics on

twoway (connected oldest_partnerhelp_table_1 oldest_newbirthdecade, lc(black) lw(thick) mc(black) msize(large))  ///
(connected oldest_partnerhelp_table_2 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) ///
(connected oldest_partnerhelp_table_3 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) /// 
, ///
ylabel(0(0.2)0.7, labsize(small)) ///
subtitle("Partner Support in Two Years after First Chilbirth",) ///
xlabel(1980 "Before 1990" 1990 "1990-99" 2000 "2000-09" 2010 "2010-19", labsize(small)) ///
xtitle("Childbirth Decade",size(small)) ytitle("Share of Mothers", size(small)) ///
graphregion(col(white)) bgcol(white)	plotregion(lc(black)) ///
legend(order(1 "Less than 25%" 2 "26-50%" 3 "More than 50%") rows(1) size(small))


gr export "Figures/Figure_3.png", width(4000) replace

restore



###TABLE 1

est clear
eststo contract: estpost tab oldest_supportive_before_table oldest_newbirthdecade if sample_mothers==1 , missing  

esttab contract ///
using "Tables/Table_1", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Very / Slightly Unsupportive" 2 "Neither" 3 "Slightly / Very Supportive" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label



###TABLE 2

est clear
eststo contract: estpost tab oldest_childcareoption_table oldest_newbirthdecade if sample_mothers==1 , missing  

esttab contract ///
using "Tables/Table_2", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Nursery" 2 "Nanny / Au Pair / Childminder" 3 "Partner / Relative / Informal" 4 "A Combination of These" 5 "None / Myself / Informal" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label



###TABLE 3

est clear
eststo contract: estpost tab oldest_research_maternity oldest_newbirthdecade if sample_mothers==1 

esttab contract ///
using "Tables/Table_3", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Research" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label

foreach x in teach admin conferences mentor journal {

	eststo contract: estpost tab oldest_`x'_maternity oldest_newbirthdecade if sample_mothers==1 
	
	esttab contract ///
	using "Tables/Table_3", ///
	mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
	cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
	varl(1 "`x'" _missing_ "Not Answered") ///	
	stats(N, label("Observations")) ///
	append csv plain label
	
}



###TABLE 4

est clear 
eststo: estpost tab oldest_research_maternity oldest_contract_table if sample_mothers==1 
esttab est* ///
using "Tables/Table_4", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Research" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label

est clear 
foreach x in teach admin conferences mentor journal {
	eststo: estpost tab oldest_`x'_maternity oldest_contract_table if sample_mothers==1 

esttab est* ///
using "Tables/Table_4", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "`x'" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
append csv plain label
}



###TABLE 5

est clear
eststo full: estpost tab oldest_fullsalrep2 oldest_newbirthdecade if sample_mothers==1 , missing  
eststo partial: estpost tab oldest_partsalrep2 oldest_newbirthdecade if sample_mothers==1 , missing  
eststo unpaid: estpost tab oldest_unpaid2 oldest_newbirthdecade if sample_mothers==1 , missing  

esttab full ///
using "Tables/Table_5", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(0 "Not offered / Did Not Take Any" 1 "Took Some" 2 "Took Max. Offered"  _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label

esttab partial ///
using "Tables/Table_5", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(0 "Not offered / Did Not Take Any" 1 "Took Some" 2 "Took Max. Offered"  _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
append csv plain label

esttab unpaid ///
using "Tables/Table_5", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(0 "Not offered / Did Not Take Any" 1 "Took Some" 2 "Took Max. Offered"  _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
append csv plain label

est clear	





###TABLE 6

la var oldest_fterm "Fixed-Term"
la var oldest_probat "Probationary"
la var oldest_nocontract "No Information"
la var oldest_lesshelp "Less Helpful than 25%"
la var oldest_morehelp "More Helpful than 50%"
la var oldest_nohelp "No Information"
la var oldest_p1_fwe_ml_d "Full Weeks Equivalent (FWE)"

est clear

glo controls "oldest_mageatbirth oldest_rolehigh oldest_rolelow oldest_responsiblow oldest_noresponsibrole oldest_lesshelp oldest_morehelp oldest_nohelp"
 
glo uni	"oldest_p1_fwe_ml oldest_russellgroup oldest_raescore_2008 oldest_acfem_pertotal2015 oldest_av_fem_sal13"

est clear
eststo: reg oldest_fullsalrep2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade
gen r11 = e(r2)
sum r11
eststo: reg oldest_partsalrep2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade
gen r21 = e(r2)
sum r21
eststo: reg oldest_unpaid2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade
gen r31 = e(r2)
sum r31

suest est1 est2 est3 , vce(robust)

outreg2 using "Tables\Table_6.xls", replace tex(frag) dec(3) pdec(3) drop(oldest_mageatbirth oldest_rolehigh oldest_rolelow oldest_responsiblow oldest_noresponsibrole oldest_russellgroup oldest_raescore_2008 oldest_acfem_pertotal2015 oldest_av_fem_sal13) label ///
addtext(R-squared, Yes , Mother's Age at Childbirth, Yes, Partner Empl. at Childbirth, Yes,  University Controls , Yes)

sum r11 r21 r31
drop r11 r21 r31 




*************************************************************************************************************************************************************************************** 
************************************************************* ONLINE APPENDIX ************************************************************* 
*************************************************************************************************************************************************************************************** 

**************************APPENDIX A

###TABLE A.1: CODE AVAILABLE UPON REQUEST (CONTAINS RESTRICTED HESA DATA)


####TABLE A.2: CODE AVAILABLE UPON REQUEST (CONTAINS RESTRICTED HESA DATA)


####TABLE A.3: "HESA" CODE AVAILABLE UPON REQUEST (CONTAINS RESTRICTED HESA DATA)

preserve 

keep curr_contractlast curr_ft curr_gross age curr_dept 
*ethnic birth_country citizen_country curr_titlelast 

la var curr_contractlast "Contract Type"
la var curr_ft "Full-Time Equivalent (FTE)"
la var curr_gross "Yearly Gross Salary"
la var age "Age"
la var curr_dept "Research Area"

foreach x of varlist _all {
egen `x'_mod=mode(`x'), maxmode
copydesc `x' `x'_mod
order `x'_mod, last
}

keep *_mod

estpost tabstat * , listwise statistics(mean) columns(statistics) 
esttab . using "Tables\Table_A3.csv" , replace cells("mean") label plain

restore 


####TABLE A.4: "HESA" CODE AVAILABLE UPON REQUEST (CONTAINS RESTRICTED HESA DATA)

***RUSSELL
preserve 

keep if curr_russellgroup==1

keep curr_contractlast curr_ft curr_gross age curr_dept 
*ethnic birth_country citizen_country curr_titlelast 

la var curr_contractlast "Contract Type"
la var curr_ft "Full-Time Equivalent (FTE)"
la var curr_gross "Yearly Gross Salary"
la var age "Age"
la var curr_dept "Research Area"

foreach x of varlist _all {
egen `x'_mod=mode(`x'), maxmode
copydesc `x' `x'_mod
order `x'_mod, last
}

keep *_mod

estpost tabstat * , listwise statistics(mean) columns(statistics) 
esttab . using "Tables\Table_A4.csv" , replace cells("mean") label plain

restore 

***NON-RUSSELL
preserve 

keep if curr_russellgroup==0

keep curr_contractlast curr_ft curr_gross age curr_dept 
*ethnic birth_country citizen_country curr_titlelast 

la var curr_contractlast "Contract Type"
la var curr_ft "Full-Time Equivalent (FTE)"
la var curr_gross "Yearly Gross Salary"
la var age "Age"
la var curr_dept "Research Area"

foreach x of varlist _all {
egen `x'_mod=mode(`x'), maxmode
copydesc `x' `x'_mod
order `x'_mod, last
}

keep *_mod

estpost tabstat * , listwise statistics(mean) columns(statistics) 
esttab . using "Tables\Table_A4.csv" , append cells("mean") label plain

restore 


####TABLE A.5: "HESA" CODE AVAILABLE UPON REQUEST (CONTAINS RESTRICTED HESA DATA)

tab curr_dept , g(curr_dept_)
estpost tabstat curr_dept_*  , listwise statistics(mean) columns(statistics) 
esttab . using "Tables\Table_A5.csv" , replace cells("mean") label plain
drop curr_dept_*


####TABLE A.6: "HESA" CODE AVAILABLE UPON REQUEST (CONTAINS RESTRICTED HESA DATA)

*RUSSELL
preserve 
keep if curr_russellgroup==1 
tab curr_dept , g(curr_dept_)
estpost tabstat curr_dept_*  , listwise statistics(mean) columns(statistics) 
esttab . using "Tables\Table_A6.csv" , replace cells("mean") label plain
drop curr_dept_*
restore 

*NON RUSSELL
preserve 
keep if curr_russellgroup==0
tab curr_dept , g(curr_dept_)
estpost tabstat curr_dept_*  , listwise statistics(mean) columns(statistics) 
esttab . using "Tables\Table_A6.csv" , append cells("mean") label plain
drop curr_dept_*
restore 


####TABLE A.7

glo controls_sum "age phd_decade curr_gross curr_professor curr_permanent njobs"

eststo mothers: estpost summarize $controls_sum if curr_mothers== 1
eststo non_mothers: estpost summarize $controls_sum if curr_mothers== 0
eststo diff_mothers: estpost ttest $controls_sum , by(curr_mothers)    


esttab mothers non_mothers diff_mothers ///
using "Tables/Table_A7", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "St. Dev. (mothers)" "St. Dev. (non-mothers)" "Count(mothers)" "Count (non-mothers)" "Diff." ) ///
cells("mean(pattern(1 1 0) fmt(2))  sd(pattern(1 1 0) fmt(2))  count(pattern(1 1 0) fmt(0)) b(pattern(0 0 1) fmt(2)) p(pattern(0 0 1) fmt(3))") ///
varl(curr_mothers "Mother" age "Age" phd_decade "PhD Decade" nkids_3 "N. Children" curr_gross_av "Gross Salary" curr_professor "Professor" curr_permanent "Permanent" njobs "N. Occupations" ) ///	
stats(N, label("Observations")) ///
replace csv plain ///
addnotes("Salary is measured by £5,000 increments from £17,500 up to £105,000, and aggregated to match the HESA classification (the same applies to age bands). Professor and Permanent are indicator variables taking value 1 if the respondent reports, respectively, her current title and tenure to be such. N. Occupations indicated the number of employment stints reported by the respondent. All variables are measured at the time of the survey.")
est clear 


####TABLE A.8

est clear
eststo contract: estpost tab oldest_contract_table oldest_newbirthdecade if sample_mothers==1 , missing  

esttab contract ///
using "Tables/Table_A8", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Fixed-Term / Probationary" 2 "Permanent" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv label plain


####FIGURE A.1

preserve

tab oldest_contract_table if sample_mothers==1 ,  missing gen(oldest_contract_table_)

collapse (mean) oldest_contract_table_* if sample_mothers==1 , by(oldest_newbirthdecade)

twoway (connected oldest_contract_table_1 oldest_newbirthdecade, lc(black) lw(thick) mc(black) msize(large))  ///
(connected oldest_contract_table_2 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) ///
(connected oldest_contract_table_3 oldest_newbirthdecade, lc(black) lw(thick) mc(black) msize(large)) ///
, ///
ylabel(0(0.2)0.7, labsize(small)) ///
subtitle("Mothers' Contract at First Chilbirth",) ///
xlabel(1980 "Before 1990" 1990 "1990-99" 2000 "2000-09" 2010 "2010-19", labsize(small)) ///
xtitle("Childbirth Decade",size(small)) ytitle("Share of Mothers", size(small)) ///
graphregion(col(white)) bgcol(white)	plotregion(lc(black)) ///
legend(order(1 "Fixed-Term/Probationary" 2 "Permanent" 3 "No Information") rows(1) size(small))


gr export "Figures/Figure_A1.png", width(4000) replace

restore


####TABLE A.9

est clear
eststo contract: estpost tab oldest_edupartner_table oldest_newbirthdecade if sample_mothers==1 , missing  

esttab contract ///
using "Tables/Table_A9", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(0 "Secondary or Below" 1 "College / University" 2 "Masters / PhD" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label

est clear
eststo contract: estpost tab oldest_rolepartner_table oldest_newbirthdecade if sample_mothers==1 , missing  

esttab contract ///
using "Tables/Table_A9", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Other" 2 "Non-Permanent / Probationary" 3 "Tenured / Permanent" 4 "Full Professor" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
append csv plain label


est clear
eststo contract: estpost tab oldest_responsibpartner_table oldest_newbirthdecade if sample_mothers==1 , missing  

esttab contract ///
using "Tables/Table_A9", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Self-Employed / Other" 2 "First-Level" 3 "Middle-Level" 4 "Upper-Middle" 5 "Senior Exec. / Top" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
append csv plain label



####FIGURE A.2

preserve

tab oldest_edupartner_table if sample_mothers==1 , missing gen(oldest_edupartner_table_)

collapse (mean) oldest_edupartner_table_* if sample_mothers==1 , by(oldest_newbirthdecade)

*set graphics on

twoway (connected oldest_edupartner_table_1 oldest_newbirthdecade, lc(black) lw(thick) mc(black) msize(large))  ///
(connected oldest_edupartner_table_2 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) ///
(connected oldest_edupartner_table_3 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) /// 
(connected oldest_edupartner_table_4 oldest_newbirthdecade, lc(gs8) lw(thick) mc(gs8) msize(large)) /// 
, ///
ylabel(0(0.2)0.7, labsize(small)) ///
subtitle("Partner Education at First Chilbirth",) ///
xlabel(1980 "Before 1990" 1990 "1990-99" 2000 "2000-09" 2010 "2010-19", labsize(small)) ///
xtitle("Childbirth Decade",size(small)) ytitle("Share of Mothers", size(small)) ///
graphregion(col(white)) bgcol(white)	plotregion(lc(black)) ///
legend(order(1 "Secondary or Below" 2 "College / University" 3 "Masters / PhD" 4 "No Information") rows(2) size(small))


gr export "Figures/Figure_A2.png", width(4000) replace

restore



####TABLE A.10

est clear
eststo contract: estpost tab oldest_primary2 oldest_newbirthdecade if sample_mothers==1 , missing  

esttab contract ///
using "Tables/Table_A10", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(0 "My Partner" 1 "Equally Split Responsibility" 2 "Me (i.e., the Mother)" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label

est clear
eststo contract: estpost tab oldest_partnerhelp_table oldest_newbirthdecade if sample_mothers==1 , missing  

esttab contract ///
using "Tables/Table_A10", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Less than 25%" 2 "26-50%" 3 "More than 50%" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
append csv plain label


####TABLE A.11

est clear
eststo: estpost tab oldest_primary2 oldest_contract_table if sample_mothers==1 , missing  
esttab est* ///
using "Tables/Table_A11", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(0 "My Partner" 1 "Equally Split Responsibility" 2 "Me (i.e., the Mother)" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label


####TABLE A.12

est clear 
eststo: estpost tab oldest_supportive_before_table oldest_contract_table if sample_mothers==1 , missing  
esttab est* ///
using "Tables/Table_A12", ///
mtitles("Mean (mothers)" "Mean (non-mothers)" "Diff." ) ///
cells("b(pattern(1 1) fmt(0)) colpct(pattern(1 1) fmt(2))") ///	
varl(1 "Very / Slightly Unsupportive" 2 "Neither" 3 "Slightly / Very Supportive" _missing_ "Not Answered") ///	
stats(N, label("Observations")) ///
replace csv plain label






**************************APPENDIX B

####TABLE B.1

preserve 

use "OMP_data", clear

est clear
eststo full: estpost tab p1_fwe_ml_last_d
la var p1_fwe_ml_last_d "Full Weeks Equivalent (FWE)"

esttab full ///
using "Tables/Table_B1", ///
cells("b(pattern(1 1) fmt(0)) pct(pattern(1 1) fmt(2))") ///	
collabels ("Number" "Percent") /// 
replace csv plain label addnotes("FWE captures the full monetary value of the maternity leave benefit, i.e., the number of weeks in which the mother received the equivalent of her full salary. Calculations are provided in the paper. Individual-level dependent and independent variables come from the survey, information on OMP from a round of FOI requests filed in December 2019.")


####TABLE B.2 

est clear
eststo full: estpost tab yearlastr_ml_d 
la var yearlastr_ml_d "Year OMP Last Reviewed"
format yearlastr_ml_d %9.0f

esttab full ///
using "Tables/Table_B2", ///
cells("b(pattern(1 1) fmt(0)) pct(pattern(1 1) fmt(2))") ///	
collabels ("Number" "Percent") /// 
replace csv plain label addnotes("Information on OMP comes from a round of FOI requests filed in December 2019.")

restore 


###3. FWE BY TIME OF FIRST CHILD


est clear
eststo full: estpost tab oldest_p1_fwe_ml_d
la var oldest_p1_fwe_ml_d "FWE at First Childbirth"
format oldest_p1_fwe_ml_d %9.2f

esttab full ///
using "Tables/Table_B3", ///
cells("b(pattern(1 1) fmt(0)) pct(pattern(1 1) fmt(2))") ///	
collabels ("Number" "Percent") /// 
replace csv plain label addnotes("FWE captures the full monetary value of the maternity leave benefit, i.e., the number of weeks in which the mother received the equivalent of her full salary. Calculations are provided in the paper. Individual-level dependent and independent variables come from the survey, information on OMP from a round of FOI requests filed in December 2019.")

est clear	




#####TABLE B.4 

est clear

glo controls "oldest_mageatbirth oldest_rolehigh oldest_rolelow oldest_responsiblow oldest_noresponsibrole oldest_lesshelp oldest_morehelp oldest_nohelp"
 
glo uni	"oldest_p1_fwe_ml oldest_russellgroup oldest_raescore_2008 oldest_acfem_pertotal2015 oldest_av_fem_sal13"

est clear
eststo: reg oldest_fullsalrep2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade if oldest_newbirthdecade<2010 & oldest_newbirthdecade!=.
gen r11 = e(r2)
sum r11
eststo: reg oldest_partsalrep2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade if oldest_newbirthdecade<2010 & oldest_newbirthdecade!=.
gen r21 = e(r2)
sum r21
eststo: reg oldest_unpaid2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade if oldest_newbirthdecade<2010 & oldest_newbirthdecade!=.
gen r31 = e(r2)
sum r31

suest est1 est2 est3 , vce(robust)

outreg2 using "Tables\Table_B4.xls", replace tex(frag) dec(3) pdec(3) drop(oldest_mageatbirth oldest_rolehigh oldest_rolelow oldest_responsiblow oldest_noresponsibrole oldest_russellgroup oldest_raescore_2008 oldest_acfem_pertotal2015 oldest_av_fem_sal13) label ///
addtext(R-squared, YES, Mother's Age at Birth, YES,  University at Birth, YES, Chilbirth Year FEs, Yes, Research Area FEs, Yes)

sum r11 r21 r31
drop r11 r21 r31 


####TABLE B.5

est clear

glo controls "oldest_mageatbirth oldest_rolehigh oldest_rolelow oldest_responsiblow oldest_noresponsibrole oldest_lesshelp oldest_morehelp oldest_nohelp"
 
glo uni	"oldest_p1_fwe_ml oldest_russellgroup oldest_raescore_2008 oldest_acfem_pertotal2015 oldest_av_fem_sal13"

est clear
eststo: reg oldest_fullsalrep2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade if oldest_newbirthdecade>=2010 & oldest_newbirthdecade!=.
gen r11 = e(r2)
sum r11
eststo: reg oldest_partsalrep2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade if oldest_newbirthdecade>=2010 & oldest_newbirthdecade!=.
gen r21 = e(r2)
sum r21
eststo: reg oldest_unpaid2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade if oldest_newbirthdecade>=2010 & oldest_newbirthdecade!=.
gen r31 = e(r2)
sum r31

suest est1 est2 est3 , vce(robust)

outreg2 using "Tables\Table_B5.xls", replace tex(frag) dec(3) pdec(3) drop(oldest_mageatbirth oldest_rolehigh oldest_rolelow oldest_responsiblow oldest_noresponsibrole oldest_russellgroup oldest_raescore_2008 oldest_acfem_pertotal2015 oldest_av_fem_sal13) label ///
addtext(R-squared, YES, Mother's Age at Birth, YES,  University at Birth, YES, Chilbirth Year FEs, Yes, Research Area FEs, Yes)

sum r11 r21 r31
drop r11 r21 r31 



####TABLE B.6

est clear

glo controls "oldest_mageatbirth oldest_rolehigh oldest_rolelow oldest_responsiblow oldest_noresponsibrole oldest_lesshelp oldest_morehelp oldest_nohelp"
 
glo uni	"oldest_p1_fwe_ml oldest_russellgroup oldest_raescore_2008 oldest_acfem_pertotal2015 oldest_av_fem_sal13"

est clear
eststo: ologit oldest_fullsalrep2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade , or
gen r11 = e(r2)
sum r11
eststo: ologit oldest_partsalrep2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade , or
gen r21 = e(r2)
sum r21
eststo: ologit oldest_unpaid2 oldest_fterm oldest_probat oldest_nocontract $controls $uni i.curr_dept i.oldest_newbirthdecade , or
gen r31 = e(r2)
sum r31

suest est1 est2 est3 , vce(robust)

outreg2 using "Tables\Table_B6.xls", replace tex(frag) dec(3) pdec(3) drop(oldest_mageatbirth oldest_rolehigh oldest_rolelow oldest_responsiblow oldest_noresponsibrole oldest_russellgroup oldest_raescore_2008 oldest_acfem_pertotal2015 oldest_av_fem_sal13) label ///
addtext(R-squared, YES, Mother's Age at Birth, YES,  University at Birth, YES, Chilbirth Year FEs, Yes, Research Area FEs, Yes) ///
eform 


drop r11 r21 r31 
